<?php
    session_start();
	ob_start();
	
	require_once("includes/connect_db.php");
	require_once("includes/function.php");
    
	$sql = "SELECT id_sim FROM tb_opt";
    $query = mysql_query($sql);
    $sim = mysql_fetch_array($query);
    $_SESSION[ses_idSim] = $sim[0];

    include("includes/sso/function-access.php");
    
    // echo "<pre>";
    // print_r($_SESSION);
    // echo "</pre>";
	
    readCookie();
    isLogin();
    if($_SERVER['SCRIPT_NAME']!='/index.php'){
        fileAccess("http://seo.com");
    }
    readNotif();
	
	if($_SESSION[ses_userType] == '1' || $_SESSION[ses_userType] == '3') {
		$query = "SELECT * FROM f_tb_pegawai WHERE id_pegawai = '$_SESSION[ses_pID]'";
		$data = mysql_query($query);
		$baris = mysql_fetch_array($data);
		
		$_SESSION[nim] = '';
		$_SESSION[nip] = $baris[nip];
	}
	else {
		$query = "SELECT * FROM tb_mhs WHERE id_mhs = '$_SESSION[ses_pID]'";
		$data = mysql_query($query);
		$baris = mysql_fetch_array($data);
		
		$_SESSION[nim] = $baris[nim];
		$_SESSION[nip] = '';
	}
	
    $_SESSION[id_user] = $_SESSION[ses_pID];
?>